<extend name="Base/common"/>

<block name="style">
    <link href="__CSS__/shops.css" rel="stylesheet" type="text/css"/>

</block>
<block name="header">
    <include file="_nav"/>
</block>
<block name="body">
    <div class="container">
        <div class="row shop">
            <div class="col-xs-12  clearfix">
                <div class="col-xs-12 common_block_border ">
                    <div class="col-xs-9 fl_left goods_detail">
                        <div class="row pad_15">
                            <h2 class="title_content">{:L('_CATEGORY_')}&nbsp;->&nbsp;<a
                                    href="{:U('goods',array('category_id'=>$top_category))}">{$category_name}</a>
                                <if condition="$child_category_name neq '' && $child_category_name neq null">
                                    &nbsp;->&nbsp;<a
                                        href="{:U('goods',array('category_id'=>$category_id))}">{$child_category_name}</a>
                                </if><?php
                    $cover_path=getThumbImageById($content['goods_ico']);?>
                                &nbsp;->&nbsp;<a
                                        href="{:U('goodsDetail',array('id'=>$content['id']))}">{$content.goods_name}</a>
                         <span  class="pull-right" style="margin-right: 190px;font-size: 14px">
            {:W('Weibo/Share/shareBtn',array('param'=>array('img'=>$cover_path,'title'=>$content['goods_name'],'content'=>$content['goods_detail'],'from'=>$MODULE_ALIAS,'site_link'=>U('Shop/Index/goodsdetail',array('id'=>$content['id']))),'text'=>L('_STATION_SHARE_WITH_SINGLE_')))}
                 </span>
                            </h2>
                            <div class="pull-right" style="margin-top: -40px;margin-right: 10px;">
                                {:W('Common/Share/detailShare')}
                            </div>

                            <div class="col-xs-6">
                                <img class="img-responsive" src="{$content.goods_ico|getThumbImageById=359,270}"/>
                            </div>

                            <div class="col-xs-6">
                        <span  class="pull-right" style="margin-right:10px;margin-top: 0px; font-size: 14px;">
            {:W('Weibo/Share/shareBtn',array('param'=>array('img'=>$cover_path,'title'=>$content['goods_name'],'content'=>$content['goods_detail'],'from'=>$MODULE_ALIAS,'site_link'=>U('Shop/Index/goodsdetail',array('id'=>$content['id']))),'text'=>"站内分享"))}
                 </span>
                                <h3 class="text-more mb_34" style="width: 100%"><font title="{$content.goods_name|op_t}">{$content.goods_name}</font>
                                </h3>

                                <div class="clearfix mb_34 info_item_s">
                                    <if condition="is_login() neq 0">
                                        <font title="{:L('_MY_')}{$money_type.title}：{$my_money} {$money_type.unit}"><span>{:L('_NEED_')}{$money_type.title}：<aq>
                                            {$content.money_need} {$money_type.unit}
                                        </aq></span></font>
                                        <else/>
                                        <span>{:L('_NEED_')}{$money_type.title}：<aq>{$content.money_need} {$money_type.unit}</aq></span>
                                    </if>
                                    <span>{:L('_STOCK_')}{:L('_COLON_')}<aq>{$content.goods_num}</aq></span>
                                </div>
                                <php>
                                    $class='';
                                    if(is_login()){
                                    if($my_money>=$vo['money_need']){
                                    $class='open-popup-link';
                                    }else{
                                    $class='money_not_enough ';
                                    }
                                    }
                                </php>
                                <div class="mb_34"><a href="#frm-post-popup" class="{$class} btn exchange_goods btn-primary "
                                                      goods_id="{$content['id']}">&nbsp;&nbsp;{:L('_EXCHANGE_')}&nbsp;&nbsp;</a>
                                </div>
                                <div class="text-more mb_34 intro">
                                <span><font
                                        title="{$content.goods_introduct|op_t}">{$content.goods_introduct}</font></span>
                                </div>
                                <div class="time_show">
                                    {:L('_DELIVER_TIME_')}{:L('_COLON_')} {:date('Y-m-d',$content['createtime'])}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    {:L('_UPDATE_TIME_')}{:L('_COLON_')} {:date('Y-m-d',$content['changetime'])}
                                </div>
                            </div>
                        </div>
                        <div class="details">
                            <h3>{:L('_PRODUCT_DETAIL_')}</h3>
                            {$content.goods_detail}
                        </div>
                        <div style="padding: 0 20px;">
                            {:hook('consult',array('table_name'=>'shop','row_id'=>$content['id'],'limit'=>20,'goods_uid'=>$content['uid'],'from_url'=>'Shop/Index/goodsDetail/id/'.$content['id'],'name'=>'积分商城'))}
                        </div>
                        <div style="padding: 5px 20px 50px 20px;">
                            {:hook('localComment', array('path'=>"Shop/goodsDetail/$content[id]", 'uid'=>$content['uid'],'this_url'=>'shop/index/goodsdetail'))}
                        </div>
                    </div>
                    <div class="col-xs-3 fl_left">
                        <if condition="is_login() neq 0">
                            <div class="row pad_15">
                                <h2 style="font-size: 16px;">{:L('_VIEW_RECENT_')}</h2>

                                <div class="goods_same_category clearfix">
                                    <ul>
                                        <volist name="goods_see_list" id="vo">
                                            <li class="items clearfix">
                                                <dl>
                                                    <dt><a href="{:U('Shop/Index/goodsDetail',array('id'=>$vo['id']))}"><img
                                                            class="img-responsive" style="max-width: 120px"
                                                            src="{$vo.goods_ico|getThumbImageById=135,135}"></a></dt>

                                                    <dd>
                                                        <h3 class="text-more"><font
                                                                title="{$vo.goods_name|op_t}">{$vo.goods_name}</font>
                                                        </h3>

                                                        <div class="money"><font title="{:L('_NEED_')}{$money_name}"><i class="ico_to_money"></i>&nbsp;{$vo.money_need}</font>
                                                        </div>

                                                        <php>
                                                            $class='';
                                                            if(is_login()){
                                                            if($my_money>=$vo['money_need']){
                                                            $class='open-popup-link';
                                                            }else{
                                                            $class='money_not_enough ';
                                                            }
                                                            }
                                                        </php>
                                                        <div><a href="#frm-post-popup"
                                                                class="{$class} btn exchange_goods btn-primary"
                                                                goods_id="{$vo['id']}">&nbsp;{:L('_EXCHANGE_')}&nbsp;</a></div>
                                                    </dd>
                                                </dl>
                                            </li>
                                        </volist>
                                    </ul>
                                </div>
                                <if condition="count($goods_see_list) eq 0">
                                    <div style="font-size: 16px;padding:2em 0;color: #ccc;text-align: center">
                                        {:L('_TIP_OTHER_PRODUCT_NOT_VIEWED_')}
                                    </div>
                                </if>
                            </div>
                        </if>
                        <div class="row pad_15">
                            <h2 style="font-size: 16px;">{:L('_CONTRAST_SAME_CATEGORY_')}</h2>

                            <div class="goods_same_category clearfix">
                                <ul>
                                    <volist name="contents_same_category" id="vo">
                                        <li class="items clearfix">
                                            <dl>
                                                <dt><a href="{:U('Shop/Index/goodsDetail',array('id'=>$vo['id']))}"><img
                                                        class="img-responsive" style="max-width: 120px"
                                                        src="{$vo.goods_ico|getThumbImageById=135,135}"></a></dt>
                                                <dd>
                                                    <h3 class="text-more"><font
                                                            title="{$vo.goods_name|op_t}">{$vo.goods_name}</font>
                                                    </h3>

                                                    <div class="money"><font title="{:L('_NEED_')}{$money_name}"><i class="ico_to_money"></i>&nbsp;{$vo.money_need}</font>
                                                    </div>
                                                    <php>
                                                        $class='';
                                                        if(is_login()){
                                                        if($my_money>=$vo['money_need']){
                                                        $class='open-popup-link';
                                                        }else{
                                                        $class='money_not_enough ';
                                                        }
                                                        }
                                                    </php>
                                                    <div><a href="#frm-post-popup" class="{$class} btn exchange_goods btn-primary"
                                                            goods_id="{$vo['id']}">&nbsp;{:L('_EXCHANGE_')}&nbsp;</a></div>
                                                </dd>
                                            </dl>
                                        </li>
                                    </volist>
                                </ul>
                            </div>
                            <if condition="count($contents_same_category) eq 0">
                                <div style="font-size: 16px;padding:2em 0;color: #ccc;text-align: center">
                                    {:L('_TIP_PRODUCT_SAME_CATEGORY_NONE_')}
                                </div>
                            </if>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        <if condition="is_login()">
            <!-- Modal -->
            <div id="frm-post-popup" class="white-popup mfp-hide" style="max-width: 500px;">
                <h2>{:L('_H_RECEIVING_INFO_')}<span style="font-size: 12px;color: #BEBEBE;">{:L('_H_RECEIVING_INFO_VICE_')}</span></h2>

                <div class="aline" style="margin-bottom: 10px"></div>
                <div class="row">
                    <form class="form-horizontal  ajax-form" role="form" action="{:U('Shop/Index/goodsBuy')}" method="post">
                        <input type="hidden" id="goods_id" name="id" value="">
                        <input type="hidden" name="address_id" value="{$shop_address['id']}">

                        <div class="form-group">
                            <label for="name" class="col-xs-2 control-label" style="width: 20%">{:L('_NAME_')}</label>

                            <div class="col-xs-10" style="width: 60%">
                                <input id="name" name="name" type="text" class="form-control"
                                       value="{$shop_address['name']}" placeholder="{:L('_NAME_')}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-xs-2 control-label" style="width: 20%">{:L('_RECEIVING_ADDRESS_')}</label>

                            <div class="col-xs-10" style="width: 60%">
                        <textarea id="address" name="address" class="form-control" placeholder="{:L('_RECEIVING_ADDRESS_')}"
                                  style="max-width: 310px">{$shop_address['address']}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="zipcode" class="col-xs-2 control-label" style="width: 20%">{:L('_POST_CODE_')}</label>

                            <div class="col-xs-10" style="width: 60%">
                                <input id="zipcode" name="zipcode" type="text" class="form-control"
                                       value="{$shop_address['zipcode']}" placeholder="{:L('_POST_CODE_')}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="phone" class="col-xs-2 control-label" style="width: 20%">{:L('_PHONE_NUMBER_')}</label>

                            <div class="col-xs-10" style="width: 60%">
                                <input id="phone" name="phone" type="text" class="form-control"
                                       value="{$shop_address['phone']}" placeholder="{:L('_PHONE_NUMBER_')}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-xs-10">
                                <button type="submit" class="btn btn-primary ">{:L('_SUBMIT_')}</button>
                            </div>
                        </div>
                    </form>
                </div>


            </div>
            <!-- /.modal -->
        </if>
    </div>
    <input type="hidden" id="money_name" value="{$money_name}"/>
</block>

<block name="script">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script>
        var money_name=$('#money_name').val().trim();
        $(function () {
            $('.exchange_goods').click(function () {
                if (MID == 0) {
                    toast.info("{:L('_TOAST_TIP_LOG_')}{:L('_EXCLAMATION_')}", "{:L('_TOAST_TIP_PROMPT_')}");
                    return false;
                }
                var goods_id = this.getAttribute('goods_id');
                $('#goods_id').val(goods_id);
            });
            if (MID != 0) {
                $('.money_not_enough').click(function () {
                    toast.info("{:L('_TOAST_TIP_LACK_')}" + money_name + "{:L('_TOAST_TIP_LACK2_')}{:L('_EXCLAMATION_')}", "{:L('_TOAST_TIP_PROMPT_')}");
                    return false;
                });
                $('.open-popup-link').magnificPopup({
                    type: 'inline',
                    midClick: true, // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
                    closeOnBgClick: false
                });
            }
        })
    </script>
</block>
